package Tests;

import static org.junit.Assert.assertEquals;

import java.io.IOException;

import model.conversations.Conversation;
import model.conversations.ConversationManager;
import model.conversations.Phrase;

import org.junit.Before;
import org.junit.Test;

import view.input.InputWords;


import exceptions.InvalidConversationNumber;


public class ConversationMegaTest {

	
	Conversation saul1a;
	
	@Before
	public void setup(){
		ConversationManager m = new ConversationManager();
		try {
			m.loadConversationFromFile("saul1a.fgc");
		} catch (IOException e) {
			// TODO Auto-generated catch block
			System.out.println(System.getProperty("user.dir"));
			e.printStackTrace();
			
		}
		try {
			saul1a = m.selectConversation("saul1a");
		} catch (InvalidConversationNumber e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		/*saul1a = new Conversation("","What can I do for you");
		saul1a.setReply(0,"","No. I need to best men for this mission","I:COME|JOIN:JOURNEY|expedition|mission|stonehaven",false,false);
		saul1a.setReply(0,"","Come where?","I:MUST:COME",false,false);
		saul1a.setReply(1,"","How?","I:USEFUL",false,false);
		saul1a.setReply(1,"","Sounds like we could need you","I:COOK|SPY|SCOUT",true,true);*/
	}
	


	
	@Test
	public void testConv(){
		String out;
		System.out.println("------------------------------");
		///////////////////////////////////
		InputWords words = new InputWords();
		
		words.setWord1("I");
		words.setWord2("COME");
		words.setWord3("JOURNEY");
		
		out=saul1a.getReply(words);
		System.out.println("first: "+out);
		assertEquals(out,"No. I need to best men for this mission");
		System.out.println("------------------------------");
		////////////////////////////////////
		InputWords words2 = new InputWords();
		words2.setWord1("I");
		words2.setWord2("USEFUL");
		
		out=saul1a.getReply(words2);
		System.out.println("second: "+out);
		assertEquals(out,"How?");
		System.out.println("------------------------------");
		////////////////////////////////////
		InputWords words0 = new InputWords();
		
		words0.setWord1("I");
		words0.setWord2("USEFUL");

		out=saul1a.getReply(words0);
		System.out.println("third: "+out);
		assertEquals(out,"you already asked me that");
		System.out.println("------------------------------");
		////////////////////////////////////
		InputWords words4 = new InputWords();
		
		words4.setWord1("I");
		words4.setWord2("COOK");

		out=saul1a.getReply(words4);
		System.out.println("fourth: "+out);
		assertEquals(out,"Sounds like we could need you");
		System.out.println("------------------------------");
		////////////////////////////////////
		InputWords words5 = new InputWords();
		
		words5.setWord1("I");
		words5.setWord2("COOK");

		out=saul1a.getReply(words5);
		System.out.println("fifth: "+out);
		assertEquals(out,"you already asked me that");
		System.out.println("------------------------------");
		////////////////////////////////////
		InputWords words6 = new InputWords();
		
		words6.setWord1("I");
		words6.setWord2("MUST");
		words6.setWord3("COME");

		out=saul1a.getReply(words6);
		System.out.println("sixth: "+out);
		assertEquals(out,"Come where?");
		System.out.println("------------------------------");
		////////////////////////////////////
	}
	
	
}
